package cn.structure.ipc;

import cn.structure.edp.CreateObject;
import cn.structure.edp.Retrieve;

import java.util.Objects;

public class RetrieveNew extends IpcEntity {
    private Retrieve retrieve;
    private CreateObject createObject;

    public RetrieveNew(Retrieve retrieve, CreateObject createObject) {
        super();
        this.retrieve = retrieve;
        this.createObject = createObject;
    }

    public enum Role {
        retrieve, createObject
    }

    public Retrieve getRetrieve() {
        return retrieve;
    }

    public void setRetrieve(Retrieve retrieve) {
        this.retrieve = retrieve;
    }

    public CreateObject getCreateObject() {
        return createObject;
    }

    public void setCreateObject(CreateObject createObject) {
        this.createObject = createObject;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("RetrieveNew{\n\t");
        sb.append(super.toString());
        sb.append("\n\t\"retrieve\":")
                .append(retrieve);
        sb.append(",\n\t\"createObject\":")
                .append(createObject);
        sb.append("\n}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        RetrieveNew that = (RetrieveNew) o;
        return Objects.equals(retrieve, that.retrieve) &&
                Objects.equals(createObject, that.createObject);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), retrieve, createObject);
    }
}
